import math
class Point:
    def __init__(self, x=0, y=0):
        self.x = x
        self.y = y
Vector=Point
def get_vec(A,B):
    return Vector(B.x-A.x, B.y-A.y)
# 计算两个向量的点乘
def dot_product(v1,v2):
    return v1.x*v2.x+v1.y*v2.y
# 计算两向量的叉乘
def cross_product(v1,v2):
    return v1.x*v2.y-v1.y*v2.x
# 计算两点之间的距离
def distance(v1,v2):
    return math.sqrt((v1.x-v2.x)**2+(v1.y-v2.y)**2)
# 计算点A到点直线BC的距离
def point_to_line_distance(A,B,C):
    cross = cross_product(get_vec(A,B),get_vec(C,B))
    line_length=distance(B,C)  # 直线的长度
    return abs(cross)/line_length # 点到直线的距离
T=int(input())
for _ in range(T):
    x,y=map(int,input().split())
    A=Point(x,y)
    x,y=map(int,input().split())
    B=Point(x,y)
    x,y=map(int,input().split())
    C=Point(x,y)
    print("{:.2f".format(point_to_line_distance(A,B,C)))